// /wxapp/getTypeList
import request from "../utils/request";
export function getTypeList() {
	return request({
		url: '/wxapp/getTypeList'
	})
}
// 首页-头部banner+新闻中心banner
export function getMkList() {
	return request({
		url: '/wxapp/getMkList'
	})
}

// wxapp/getAdList
export function getAdList() {
	return request({
		url: '/wxapp/getAdList'
	})
}

// /wxapp/getTypeListByPid?pid=1
// 首页-产品页-右侧数据
export function getTypeListByPid(pid) {
	return request({
		url: '/wxapp/getTypeListByPid',
		data: {
			pid: pid
		}
	})
}
// /wxapp/getDocumentList?goods_id=1&document_type_id=1

export function getGoodsDetail(goods_id, group_id = "", value_id = "") {
	return request({
		url: '/wxapp/getGoodsDetail',
		data: {
			goods_id: goods_id,
			group_id: group_id,
			value_id: value_id
		}
	})
}
export function getSpecValue(params){
	return request({
		url: '/wxapp/getSpecValue',
		data: params,
		method:"POST"
	})
}

// /wxapp/addCarts
export function addCarts(data) {
	return request({
		url: '/wxapp/addCarts',
		data: data,
		method: "POST"
	})
}

// /getCartsList?customer_id=1
export function getCartsList(customer_id) {
	return request({
		url: '/wxapp/getCartsList',
		data: {
			customer_id: customer_id,
		}
	})
}
// /wxapp/cartsChecked?id=1&checked=0
// 单选
export function cartsChecked(id, checked) {
	return request({
		url: '/wxapp/cartsChecked',
		data: {
			id: id,
			checked: checked
		}
	})
}

// /wxapp/cartsAllChecked?customer_id=1&checked=1
// 全选
export function cartsAllChecked(id, checked) {
	return request({
		url: '/wxapp/cartsAllChecked',
		data: {
			customer_id: id,
			checked: checked
		}
	})
}

// /wxapp/cartsNumAdd?id=1&num=2
// 修改数量
export function cartsNumAdd(id, num) {
	return request({
		url: '/wxapp/cartsNumAdd',
		data: {
			id: id,
			num: num
		}
	})
}
// wxapp/cartsDelAll?ids=1,2
// 删除
export function cartsDelAll(id) {
	return request({
		url: '/wxapp/cartsDelAll',
		data: {
			ids: id
		}
	})
}
// wxapp/submitOrder
// 生成订单
export function submitOrder(id) {
	return request({
		url: '/wxapp/submitOrder',
		data: { customer_id: id },
		method: "POST"
	})
}
// /wxapp/getGoodsList?page=1&limit=10&goods_name=&goods_type_oid=
// 搜素
export function getGoodsList(params) {
	return request({
		url: '/wxapp/getGoodsList',
		data: {
			goods_name: params.goods_name ? params.goods_name : '',
			goods_type_oid: params.goods_type_oid ? params.goods_type_oid : '',
			goods_type_tid: params.goods_type_tid ? params.goods_type_tid : '',
			page: params.page ? params.page : 1,
			limit: params.limit ? params.limit : 20,
			...params
		}
	})
}

// /wxapp/sendDocument
export function sendDocument(data) {
	return request({
		url: '/wxapp/sendDocument',
		data: data,
		method: "POST"
	})
}
// /wxapp/sendCarts
export function sendCarts(data) {
	return request({
		url: '/wxapp/sendCarts',
		data: data,
		method: "POST"
	})
}
// /wxapp/getIndexTypeList
export function getIndexTypeList() {
	return request({
		url: '/wxapp/getIndexTypeList'
	})
}
// /wxapp/goodsAttachmentList?goods_id=1
export function goodsAttachmentList(id) {
	return request({
		url: '/wxapp/goodsAttachmentList',
		data:{goods_id:id}
	})
}